<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>留言板</title>
    <link rel="stylesheet" type="text/css" href="./public/index/css/home.css">
</head>
<body>

<div id="head">
    <div id="head_son">
            <span>欢迎：
                <?php
                    echo $_SESSION['username'];
                ?>
            </span>
    </div>
</div>

<div id="left">
    <h1>留言内容</h1>
    <?php
    if(is_array($data) && !empty($data)){
        foreach($data as $key => $value){
    if($_SESSION["id"] == $value['p_id']){  ?>
    <div id="box_right">
        <?php   }else{  ?>
        <div id="box_left">
            <?php    }  ?>
            <form method="post">
                <span>发送人：</span><?php echo $value['put_username']; ?><br>
                <span>接收人：</span><?php echo $value['get_username']; ?><br>
                <div style="width: 400px;color: black"><span>时间：</span><?php echo $value['time']; ?></div>
                <span>内容：</span><br>
                <div id="text"><?php echo $value['text']; ?></div>
                <input type="hidden" name="id" value="<?php echo $value['id']; ?>"><br>
                <input type="submit" value="删除" name="delete">
                <?php   if($_SESSION["id"] == $value['p_id']){  ?>
                <input type="submit" value="修改" name="update1" onclick="return on_sub()">
                <?php   }   ?>
            </form>
        </div>
        <?php   };
    }?>
    </div>

    <div id="right">
        <button onclick="bti()">发送留言</button><br><br>
        <button onclick="btn()">退出登录</button>
    </div>

</div>
<script type="text/javascript" src="./public/index/js/home.js"></script>
</body>
</html>